package com.android.Servlet;

import java.io.IOException;
import java.io.PrintWriter;
import java.sql.SQLException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.android.Bean.ServerRecordBean;

@SuppressWarnings("serial")
public class ServerRecordServlet extends HttpServlet {

	/**
		 *服务记录填写
		 */
	public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doPost(request, response);
	}

	
	public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		response.setCharacterEncoding("gbk");
		ServerRecordBean serverRecordBean=new ServerRecordBean();
		request.setCharacterEncoding("gbk");
		String serverTitle=request.getParameter("serverTitle");
		String serverContent=request.getParameter("serverContent");
		System.out.println(serverTitle);
		PrintWriter pw =response.getWriter();
		try {
			serverRecordBean.serverRecordInsert(serverTitle, serverContent);
			pw.append("true");
			pw.flush();
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
			pw.append("false");
			pw.flush();
		} catch (SQLException e) {
			e.printStackTrace();
			pw.append("false");
			pw.flush();
		}
	}

}
